<!DOCTYPE html>
<!--[if lte IE 9]><html class="lt-ie10 lt-ie9" xmlns="http://www.w3.org/1999/xhtml"> <![endif]-->
<!--[if gt IE 9]><!-->
<html>
<!--<![endif]-->

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>赛尔（赛er）——消息中心</title>
    <meta name="keywords" content="赛尔（赛er）是一个面向全国各大高校大学生的一站式社区平台，集竞赛活动发布和讨论为一体，提供发布、查询、组队、经验分享等多元化服务。" />
    <meta name="description"
          content="平台聚合了国内各大高校的校内比赛以及国内外各领域最优质的赛事活动信息。赛事内容囊括创新创业、演讲辩论、财会金融、艺术设计、学科竞赛、公益志愿等众多领域。赛尔（赛er）致力于打造一个融合大学生学习、赛事、活动、保研、考研等为一体的成长交流空间。" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta http-equiv="Access-Control-Allow-Origin" content="*" />
    <meta name="renderer" content="webkit">


    <link rel="stylesheet" type="text/css" href="/static/css/top-4.9.6.2.min.css">
    <script type="text/javascript" src="../common/common.js"></script>
    <style type="text/css">
        .sk-user-acticle-list-box .cp-show-more-btn {
            width: 100%;
        }
        .cp-show-more-btn {
            display: block;
            color: #666;
            font-size: 14px;
            height: 46px;
            text-align: center;
            width: 818px;
            background: #eee;
            border: 1px solid #e5e5e5;
            cursor: pointer;
        }
    dd.layui-this a {
        background-color: white !important;
    }
    img{
        object-fit: cover;
    }
    .msg-center-inform-box {
        width: 820px;
        margin: 30px auto 110px;
    }

    .msg-center-num-results {
        color: #aaa;
        height: 33px;
        border-bottom: 2px solid #ddd;
    }

    .msg-show-results.active {
        color: #666;
    }

    .msg-center-inform-box .item {
        padding: 25px 0 20px;
        border-bottom: 1px solid #e6e6e6;
    }

    .clearfix {
        zoom: 1;
    }

    .msg-center-inform-box .msg-hint {
        width: 20px;
        height: 20px;
        background-color: #ccc;
        border-radius: 50%;
        margin: 3px 10px 0 0;
    }

    .fl {
        float: left;
    }

    .fr {
        float: right;
    }

    .msg-center-info-detail {
        font-size: 14px;
        color: #555;
        line-height: 24px;
        max-width: 790px;
    }

    .clearfix:after {
        content: "";
        display: block;
        clear: both;
        height: 0;
        font-size: 0;
        line-height: 0;
        visibility: hidden;
    }

    .bottom-hint-msg {
        color: #aaa;
        font-size: 12px;
        margin-top: 15px;
    }

    .bottom-hint-msg .delete {
        cursor: pointer;
    }
    </style>
</head>

<body>
    <!--body-wrap-->
    <div id="app">
        <ul class="layui-nav layui-bg-cyan" style="margin: 0 auto;padding:0 12%" lay-filter="">
            <li style="display: inline-block;line-height: 60px;vertical-align: middle;position: relative;"><a href="/index.html"><img style="height: 60px;margin-right:15px;" src="/static/images/logo.png"></a></li>
            <!-- 选中 加上 layui-this -->
            <li class="layui-nav-item"><a href="/index.html">首页</a></li>
            <li class="layui-nav-item"><a href="/competition/competition.html">竞赛</a></li>
            <li class="layui-nav-item"><a href="/activity/activity.html">活动</a></li>
            <li class="layui-nav-item"><a href="/ask/ask.html">论坛</a></li>
            <li class="layui-nav-item"><a href="/article/article.html">文章</a></li>
            <li class="layui-nav-item" v-if="user!=''&&user!=null&&user!=undefined">
                <a href="javascript:;">发布</a>
                <dl class="layui-nav-child">
                    <!-- 二级菜单 -->
                    <dd><a href="/competition/publish_competition.html">创建竞赛</a></dd>
                    <dd><a href="/activity/publish_activity.html">发布活动</a></dd>
                    <dd><a href="/ask/publish_ask.html">发起提问</a></dd>
                    <dd><a href="/article/publish_article.html">发表文章</a></dd>
                </dl>
            </li>
            <template v-if="user!=''&&user!=null&&user!=undefined">
                <li class="layui-nav-item" style="float: right">
                    <a href="javascript:;" style="padding: 0 20px 0 0px">
                        <img :src="NGINX_SERVER+user.AVATAR" class="layui-nav-img">
                        {{user.NAME}}
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="/user/my_home.html">我的主页</a></dd>
                        <dd><a href="javascript:void(0);" style="color:red" onclick="logout()">退出登录</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item" style="float: right;margin-right: 25px;">
                    <a  href="/user/my_msg.html" style="cursor: pointer;"><i class="layui-icon layui-icon-notice" style="font-size: 18px;"></i><span class="layui-badge" v-if="unreadCount>0">{{unreadCount}}</span></a>
                </li>
            </template>
            <template  v-else>
                <li style="float:right" class="layui-nav-item"><a href="/login.html">登录</a></li>
                <li style="float:right" class="layui-nav-item"><a href="/reg.html">注册</a></li>
            </template>
        </ul>
        <div class="layui-container">
            <div class="msg-center-inform-box">
                <div class="msg-center-inform-con">
                    <p class="msg-center-num-results">
                        <span class="msg-show-results active">全部消息<em>({{totalSize}})</em></span>
                    </p>
                    <ul class="list" v-if="msgList.length>0">
                        <li class="item" v-for="item in msgList">
                            <div class="clearfix">
                                <p class="msg-center-info-detail fl ">
                                    {{item.MSG_CONTENT}}</p>
                            </div>
                            <p class="clearfix bottom-hint-msg">
                                <span class="pub-time fl">{{item.CREATE_TIME}}</span><button class="delete fr js_del_msg layui-btn layui-bg-red" @click="del(item.MESSAGE_ID)">删除</button><a class="delete fr js_del_msg layui-btn layui-bg-blue" style="margin-right: 10px;" target="_blank" :href="item.URL">查看</a>
                            </p>
                        </li>
                        <div class="cp-show-more js_load_more_box ">
                            <button type="button" id="loadMoreContentBtn" :class="moreClass" :disabled="more" class="cp-show-more-btn" @click="getMsgList">{{buttoninfo}}</button>
                        </div>
                    </ul>
                    <div v-else>
                        <div style="text-align: center"><i class="layui-icon layui-icon-list" style="font-size: 100px;color:#c9c9c9;"></i>
                            <p style="font-size: 20px;color:#c9c9c9;">暂无消息~</p>
                        </div>
                    </div>
                </div>
                <div class="pagination-box">
                    <ul class="pagination">
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="footer-wrap v-4-2">
        <div class="footer other">
            <div class="common-box footer-box">
                <div class="to-top-box" id="toUpBox">
                    <!--<a href="javascript:;" target="_blank" class="common-icon-big to-feedback-btn" title="意见反馈"></a>-->
                    </a>
                    <div class="iradio-2 to-msite-btn to-msite-btn-2" title="微信公众号">
            <span class="weixin-box" style="margin-top: -42px;">
              <img src="/static/images/erweima.jpg" alt="微信公众号">
              <span class="weixin-txt">关注赛er订阅号</span>
              <img src="/static/images/kefu.jpg" alt="微信客服">
              <span class="weixin-txt">添加赛er客服</span>
              <span class="arrow arrow-right boxL-cor" style="margin-top: -70px;"></span>
            </span>
                    </div>
                    <a href="javascript:;" class="to-top-btn common-icon-big" id="toUp" title="返回顶部"></a>
                </div>
                <div class="fl ft-info-box">
                    <div class="ft-tit" title="关于赛er">关于赛er</div>
                    <ul class="ft-list">
                        <li class="item">
                            <a href="" title="了解赛er" target="_blank" rel="nofollow">了解赛er</a>
                        </li>
                        <li class="item">
                            <a href="./contact.html" title="服务协议" target="_blank" rel="nofollow">服务协议</a>
                        </li>
                        <li class="item">
                            <a href="" title="合作伙伴" target="_blank" rel="nofollow">合作伙伴</a>
                        </li>
                        <li class="item">
                            <a href="" title="加入我们" target="_blank" rel="nofollow">加入我们</a>
                        </li>
                        <li class="item">
                            <a href="" title="隐私协议" target="_blank" rel="nofollow">隐私协议</a>
                        </li>
                    </ul>
                </div>
                <div class="fl ft-info-box">
                    <div class="ft-tit" title="帮助中心">帮助中心</div>
                    <ul class="ft-list">
                        <li class="item">
                            <a href="" title="常见问题" target="_blank" rel="nofollow">常见问题</a>
                        </li>
                        <li class="item">
                            <a href="./legal.html" title="社区规范" target="_blank" rel="nofollow">社区规范</a>
                        </li>
                        <li class="item">
                            <a href="" title="意见反馈" target="_blank" rel="nofollow">意见反馈</a>
                        </li>
                    </ul>
                </div>
                <div class="fr ft-info-box" style="width: 200px;">
                    <div class="ft-tit" title="在线客服">联系我们</div>
                    <ul class="ft-list">
                        <li class="item">
                            赛er<span class="item-dot"></span>客服QQ：<a href="https://wpa.qq.com/msgrd?v=3&uin=412414867&site=qq&menu=yes">412414867</a>
                        </li>
                        <li class="item">
                            赛er<span class="item-dot"></span>官方QQ群：320513949
                        </li>
                    </ul>
                </div>

            </div>
        </div>
        <!-- 备案 footer -->
        <div class="ft-btm">
            <div class="common-box ft-btm-box">
                <div class="btn-con">
                    <span class="ft-paragraph">©<span id="nowYear"></span>赛er<span class="s-4"></span></span>
                    <span><a href="https://beian.miit.gov.cn/" target="_blank" style="color: #555;">苏ICP备2021019825号</a></span>
                </div>
            </div>
        </div>
    </div>
    <script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function() {
        var element = layui.element;

        //…
    });

    var app = new Vue({
        el: '#app',
        //初始数据
        data: {
            NGINX_SERVER: '',
            totalSize:0,
            user: '',
            msgList: [],
            pageSize:10,
            pageNum:0,
            buttoninfo:"点击加载更多...",
            more:false,
            moreClass:'',
            unreadCount:0
        },
        mounted() {

            this.NGINX_SERVER = NGINX_SERVER
            
            this.setRead();
            getUnreadCount(data=>{
                app.unreadCount = data;
            });
            this.user = JSON.parse(sessionStorage.getItem("userInfo"));
            this.getMsgList()
        },
        methods: {
            getMsgList() {
                this.pageNum++;
                getDataByPost('api/user/getMsgList', {pageNum:this.pageNum,pageSize:this.pageSize}, res => {
                    if (res.code == 200) {
                        var list = res.data.list
                        if(list.length<10){
                            app.buttoninfo="暂无更多";
                            app.more=true
                            app.moreClass = "layui-disabled"
                        }
                        app.msgList = app.msgList.concat(list);
                        app.totalSize = res.data.total;
                    } else {
                        toastr.error(res.msg)
                    }
                })
            },
            setRead(){
                getDataByGet('api/user/setRead',{},res=>{
                    if(res.code==200){

                    }else{
                        toastr.error(res.msg);
                    }
                })
            },
            del(id) {
                swal({
                    title: "您确定要删除该消息吗",
                    text: "删除后将无法恢复，请谨慎操作！",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "删除",
                    closeOnConfirm: false
                }, function() {
                    getDataByPost('api/user/deleteMsg', {
                        MESSAGE_ID: id
                    }, res => {
                        if (res.code == 200) {

                            swal("删除成功！", "您已经永久删除了这条消息。", "success");
                            app.getMsgList();
                        } else {
                            toastr.error(res.msg)
                        }
                    })

                })

            }
        }

    })
    </script>
    <script>
    </script>
<script>
  toTopFun();
</script>
</body>